﻿@Imports SchoolClick.Database.jqGrid
@Code
    Dim grid = New JqGridHelper(Of jqGrid.MATERIA)("table-materias-no-asociadas",
       dataType:=JqGridDataTypes.Json, methodType:=JqGridMethodTypes.Post,
       url:=Url.Action("_get_materias_not_included_grado", "AnioEscolar", New With {.Year = ViewBag.Year, .Grado = ViewBag.Grado}),
       pager:=True, rowsNumber:=10, viewRecords:=True, width:=500, height:=250, multiSelect:=True
   ).Navigator(New JqGridNavigatorOptions() With {.Add = True, .Edit = False, .Delete = False, .Search = False,
                                                  .AddFunction = "$.handlerFakejqGrid", .AddText = "Nueva",
                                                  .AddToolTip = "Crear una nueva materia en el sistema"}
    )
End Code
<script> $(function () { @grid.GetJavaScript() }); </script>
@Using Html.BeginDialogPartialView(Url.Action("_asociar_materia_grado", "AnioEscolar", New With {.Year = ViewBag.Year}))
    @Html.TituloFieldSet("SELECCIONE LAS MATERIAS QUE DESEE ASOCIAR AL GRADO")
    @grid.GetHtml()
    @Html.loadDialogPartialViewAJAX("#add_table-materias-no-asociadas", "crear-materia-sys", "CREAR MATERIA")
End Using

<script type="text/javascript">
    $(function() {
        $('#add_table-materias-no-asociadas').attr('href', '/AnioEscolar/_new_materia_sys')
            .on('saveSuccess', function() {$("#table-materias-no-asociadas").trigger("reloadGrid");});
    })
</script>
